import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios';

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    data: []
  },
  getters: {
  },
  mutations: {
    setlist(state, data) {
      state.data = data
    }
  },
  actions: {
    getlist(context) {
      axios.get('/api/list').then((res) => {
        console.log(res);
        context.commit("setlist", res.data)
      })
    }
  },
  modules: {
  }
})
